<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="images/favicon.ico">
    <link rel="stylesheet" href="lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="css/layuimini.css" media="all">
    <link rel="stylesheet" href="css/public.css" media="all">
    <link rel="stylesheet" href="lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <style id="layuimini-bg-color">
    </style>
</head>
<body class="layui-layout-body layuimini-all">
<div class="layui-layout layui-layout-admin">

    <div class="layui-header header">
        <div class="layui-logo">
        	<h1 style="margin-left: 0px;font-size: 18px;">后台管理</h1>
        </div>
        <a>
            <div class="layuimini-tool"><i title="展开" class="fa fa-outdent" data-side-fold="1"></i></div>
        </a>

        <ul class="layui-nav layui-layout-left layui-header-menu layui-header-pc-menu mobile layui-hide-xs">
        	<li class="layui-nav-item layui-this" style="display: none" id="currencyHeaderId" data-menu="currency"> <a href="javascript:;"><i class="fa fa-address-book"></i> 菜单</a> </li>
        </ul>
        <ul class="layui-nav layui-layout-left layui-header-menu mobile layui-hide-sm">
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="fa fa-list-ul"></i> 选择模块</a>
                <dl class="layui-nav-child layui-header-mini-menu">
                </dl>
            </li>
        </ul>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;" data-refresh="刷新"><i class="fa fa-refresh"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;" data-clear="清理" class="layuimini-clear"><i class="fa fa-trash-o"></i></a>
            </li>
            <li class="layui-nav-item mobile layui-hide-xs" lay-unselect>
                <a href="javascript:;" data-check-screen="full"><i class="fa fa-arrows-alt"></i></a>
            </li>
            <li class="layui-nav-item layuimini-setting">
                <a href="javascript:;" id="username">admin</a>
                <dl class="layui-nav-child">
                	<dd>
                        <a href="javascript:;" onclick="qiehuan();" data-title="切换账号" data-icon="fa fa-gears">切换账号</a>
                    </dd>
                    <dd>
                        <a href="javascript:;" data-content-href="page/user-password.html" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
                    </dd>
                    <dd>
                        <a href="javascript:;" class="login-out">退出登录</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item layuimini-select-bgcolor mobile layui-hide-xs">
                <a href="javascript:;" data-bgcolor="配色方案"><i class="fa fa-ellipsis-v"></i></a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll layui-left-menu">
        	<ul class="layui-nav layui-nav-tree layui-this" id="currency">
				<!-- <li class="layui-nav-item layui-this" style="">
					<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-4" 
						data-one-page="page/program_list.html" target="_self">
						<i class="fa fa-window-maximize"></i>
						<span class="layui-left-nav"> 节目单管理</span>
					</a>
				</li>
				<li class="layui-nav-item">
					<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-5" 
						data-one-page="page/video_list.html" target="_self">
						<i class="fa fa-gears"></i>
						<span class="layui-left-nav"> 资源库管理</span>
					</a>
				</li>
				<li class="layui-nav-item">
					<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-5" 
						data-one-page="page/dictionary_list.html" target="_self">
						<i class="fa fa-flag-o"></i>
						<span class="layui-left-nav"> 标签管理</span>
					</a>
				</li>
				<li class="layui-nav-item">
					<a href="javascript:;" class="layui-menu-tips">
						<i class="fa fa-cogs"></i>
						<span class="layui-left-nav">系统管理</span>
						<span class="layui-nav-more"></span>
					</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-5" 
								data-one-page="page/user_list.html" target="_self">
								<i class="fa fa-tachometer"></i>
								<span class="layui-left-nav"> 用户管理</span>
							</a>
						</dd>
						<dd>
							<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-5" 
								data-one-page="page/role_list.html" target="_self">
								<i class="fa fa-tachometer"></i>
								<span class="layui-left-nav"> 角色管理</span>
							</a>
						</dd>
					</dl>
				</li> --> 
				<!-- <li class="layui-nav-item">
					<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-5" 
						data-one-page="page/user_list.html" target="_self">
						<i class="fa fa-users"></i>
						<span class="layui-left-nav"> 用户管理</span>
					</a>
				</li> -->
				<#if menuList??>
					<#list menuList as list>
						<#if list.childMenu??&&list.childMenu?size gt 0>
							<li class="layui-nav-item">
								<a href="javascript:;" class="layui-menu-tips">
									<i class="${(list.icon)!}"></i>
									<span class="layui-left-nav"> ${(list.name)!}</span>
									<span class="layui-nav-more"></span>
								</a>
								<dl class="layui-nav-child">
									<#list list.childMenu as child>
										<dd>
											<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-${(child.id)!}" 
												data-one-page="${(child.url)!}" target="_self">
												<i class="${(child.icon)!}"></i>
												<span class="layui-left-nav"> ${(child.name)!}</span>
											</a>
										</dd>
									</#list>
								</dl>
							</li>
						<#else>
							<li class="layui-nav-item">
								<a href="javascript:;" class="layui-menu-tips" data-type="tabAdd" data-mpi="m-p-i-${(list.id)!}" 
									data-one-page="${(list.url)!}" target="_self">
									<i class="${(list.icon)!}"></i>
									<span class="layui-left-nav"> ${(list.name)!}</span>
								</a>
							</li>
						</#if>
					</#list>
				</#if>
			</ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-card layuimini-page-header layui-hide-xs layui-hide">
            <div class="layui-breadcrumb" id="layuimini-page-header">
                <a><cite>菜单管理</cite></a>
            </div>
        </div>
        <div class="layuimini-content-page">
        </div>
    </div>
</div>
<script type="text/javascript" src="lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script src="lib/layui-v2.5.5/layui.js?v=1.0.4" charset="utf-8"></script>
<script src="js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="https://cdn.bootcss.com/echarts/4.4.0-rc.1/echarts.min.js"></script>
<!-- <script src="js/base.js" charset="utf-8"></script> -->
<script>
	var username = $.cookie("username");
	$("#username").text(username);
    layui.use(['element', 'layer', 'layuimini'], function () {
        var $ = layui.jquery,
            element = layui.element,
            layer = layui.layer,
            layuimini = layui.layuimini;

//         layuimini.init('api/init.json');

        $('.login-out').on("click", function () {
   			$.cookie("token","", {path: '/'});
   	   	 	$.cookie("username","", {path: '/'});
   	   	 	$.cookie("type","", {path: '/'});
            layer.msg('退出登录成功', function () {
                window.location = 'login';
            });
        });
        layuimini.listen();
    });
// var alert = function(msg){
// 	layer.alert(msg);
// }
var qiehuan = function(){
	var html = '<div id="edit-div">'+
					'<form class="layui-form" action="">'+
						'<div class="layui-form-item">'+
						    '<label class="layui-form-label">账号</label>'+
						    '<div class="layui-input-block">'+
						      '<input type="text" id="username1" name="username" required  lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">'+
						    '</div>'+
						 '</div>'+
						'<div class="layui-form-item layui-form-text">'+
						    '<label class="layui-form-label">密码</label>'+
						    '<div class="layui-input-block">'+
						    '<input type="password" id="password" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">'+
						    '</div>'+
					  '</div>'+
					'</form>'+
				'</div>';
	layer.open({
	  title: "切换账号",
	  area: ['500px', '300px'],
	  content:html,
	  yes: function(index, layero){
		  var username = $("#username1").val();
			var password = $("#password").val();
			if(username==null||username==""){
				layer.tips("请输入用户名","#username1");
				return false;
			}
			if(password==null||password==""){
				layer.tips("请输入密码","#password");
				return false;
			}
			 $.post("/login", {
		         "username": username,
		         "password": password
		     }, function (r) {
		         if (r.success) {
		        	 $.cookie("token",r.data.token, {path: '/'});
		        	 $.cookie("username",r.data.username, {path: '/'});
		        	 $.cookie("type",r.data.type, {path: '/'});
		        	 window.location.href = "index";
		         }else{
		        	 layer.tips(r.message,"#password");
		         }
		     }, 'json');
	  }
	}); 
}
</script>
</body>
</html>
